import os
import sys

# 请在此输入您的代码

n = int(input())
a, b, c = map(int, input().split())

ans = 0
for i in range(1, n + 1):
    if i % a != 0 and i % b != 0 and i % c != 0:
        ans += 1

print(ans)